home *** CD-ROM | disk | FTP | other *** search
/ Gekikoh Dennoh Club 6 / Gekikoh Dennoh Club Vol. 6 (Japan) (Track 1).bin / dsp / wave1 / w000.c next >
Encoding:
C/C++ Source or Header  |  1999-01-31  |  712 b   |  41 lines

  1. /*
  2.     261.63Hzのサイン波(80dB:3秒)
  3. */
  4.  
  5. #include    <stdio.h>
  6. #include    <math.h>
  7.  
  8. #define        GAIN        (10000)        //80dB
  9.  
  10. #define        TAR_FREQ    (261.63)    //出力
  11. #define        WAV_FREQ    (44100)        //出力ファイルの周波数
  12. #define        TIME        (3)        //出力秒数
  13.  
  14. #define        PHY1        (2.1358)    //1/44100あたりの進行角度*10000
  15.                         //261.63*360/44100*10000
  16.  
  17. #define        RAD        (3.14159265/180)
  18. #define        PHY1RAD        (0.037257061)    //PHY1*RAD
  19.                         
  20. short    Buf[WAV_FREQ*TIME];
  21.  
  22.  
  23. int    main(void)
  24. {
  25.     FILE    *fp;
  26.     int    cnt,fcnt;
  27.  
  28.     for( cnt=0;cnt<WAV_FREQ*TIME;cnt++ ){
  29.         Buf[cnt]=(short)(sin(cnt*PHY1RAD)*GAIN);
  30.     }
  31.  
  32.     
  33.     fp=fopen("W000.m44","wb");
  34.     fwrite(Buf,sizeof(short),WAV_FREQ*TIME,fp);
  35.     fclose(fp);
  36.     
  37.     return(0);
  38. }
  39.  
  40.  
  41.